<?php

namespace App\Admin\Basics;

use Dcat\Admin\Widgets\Metrics\Card;
use Illuminate\Contracts\Support\Renderable;

class TotalCard extends Card
{
    protected $modal = null;
    /**
     * 卡片底部内容.
     *
     * @var string|Renderable|\Closure
     */
    protected $footer;

    public function __construct($title = null,$value = "", $modal = null)
    {
        parent::__construct($title);
        $this->modal = $modal;
        $this->title($title);
        $this->content($value);
    }


    /**
     * 设置卡片底部内容.
     *
     * @param string|Renderable|\Closure $footer
     *
     * @return $this
     */
    public function footer($footer)
    {
        $this->footer = $footer;

        return $this;
    }

//    public function renderHeader()
//    {
//        return <<<HTML
//<div class="">
//    <button class="btn btn-info btn-sm">查看详情</button>
//</div>
//HTML;
//    }

    /**
     * 渲染卡片内容.
     *
     * @return string
     */
    public function renderContent()
    {
        $content = parent::renderContent();
        return <<<HTML
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px;">
    <h2 class="ml-1 font-lg-1" ><span class="label bg-primary">{$content}</span></h2>
    <div class="mr-2">{$this->modal}</div>
</div>
HTML;
    }

}
